using B.S.XZYData.Api.Read.Application.Command.ZSH;
using B.S.XZYData.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;

namespace B.S.XZYData.Api.Read.Controllers
{
	/// <summary>
	/// 不良品项查询接口
	/// </summary>
	[ApiController]
	[Route("api/[controller]/[action]")]
	public class DefectiveController : ControllerBase
	{
		private readonly IMediator _mediator;
		public DefectiveController(IMediator mediator) { _mediator = mediator; }

		/// <summary>
		/// 分页查询不良品项（支持编号、名称模糊查询）
		/// </summary>
		/// <param name="request">分页与筛选参数</param>
		/// <returns>分页数据</returns>
		[HttpGet]
		public Task<ApiPageing<B.S.XZYData.Api.Read.DTO.DefectiveDto>> GetPage([FromQuery] GetDefectivePageCommand request)
		{
			return _mediator.Send(request);
		}
	}
}


